package com.bigstonecontainer.training.springboot.frm.server.sys.controller;

import com.bigstonecontainer.training.springboot.frm.server.core.domain.Result;
import com.bigstonecontainer.training.springboot.frm.server.sys.domain.SysMenu;
import com.bigstonecontainer.training.springboot.frm.server.sys.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/sys/menu")
public class SysMenuController {

    @Autowired
    private SysMenuService sysMenuService;

    @GetMapping("/currentlist")
    public Result<List<SysMenu>> getCurrentUserMenuList(@RequestHeader("Authorization") String token) {
        List<SysMenu> menuList = sysMenuService.getCurrentUserMenuList(token);
        return Result.success(menuList);
    }
}
